home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / optivc32 / vgraph.h < prev    next >
C/C++ Source or Header  |  1999-03-06  |  20KB  |  424 lines

  1. /*  Vgraph.h
  2.  
  3.   graphics functions for all floating-point and integer vector types
  4.  
  5.   Copyright (c) 1996-1999 by Martin Sander
  6.   All Rights Reserved.
  7. */
  8.  
  9. #ifndef __VGRAPH_H
  10. #define __VGRAPH_H
  11. #if !defined( __VECLIB_H )
  12.    #include <VecLib.h>
  13. #endif
  14.  
  15. #if defined _WINDOWS || defined _Windows
  16.     #if defined _MSC_VER || defined __BORLANDC__
  17.          /* <windows.h> or the MFC, OWL, OCF files must be included before <VGraph.h> ! */
  18.     #else /* that means: Optima++ */
  19.         #include <WCanvas.hpp>
  20.         #include <WColor.hpp>
  21.         #define COLORREF WColor
  22.     #endif
  23. #else
  24.   #if defined( __WINDOWS_H )
  25.      #error <windows.h> must not be included, if program will run under DOS!
  26.   #endif
  27.   #include <graphics.h>
  28.   #define COLORREF unsigned   /* in <windows.h> defined as DWORD! */
  29. #endif
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35.  
  36. /********************  Plot-Routines **************************/
  37.  
  38. #if defined _WINDOWS || defined _Windows
  39.     #if defined __BORLANDC__ || defined _MSC_VER
  40.         void  __vf  V_initPlot( HWND vhwnd, HDC vdc );
  41.         void  __vf  V_initPrint( HDC vprintdc );
  42.     #else  /* Optima++ */
  43.         void  __vf  V_initPlot( WCanvas _VFAR *vcanv );
  44.         void  __vf  V_initPrint( WPrinterCanvas _VFAR *vcanvas );
  45.     #endif
  46. #else   /*  DOS: use Borland's BGI   */
  47.         void  __vf  V_initGraph( char _VFAR *pathtodriver );
  48.         void  __vf  V_initPlot( int graphmode );
  49. #endif
  50. void  __vf  V_setPlotRegion( int left, int top, int right, int bottom );
  51. void  __vf  V_setSymbolSize( float symsize );
  52. void  __vf  V_setLineThickness( unsigned thickness );
  53. int   __vf  V_findAxisRange( extended _VFAR *LoX, extended _VFAR *HiX,
  54.                              extended Xmin, extended Xmax );
  55. void  __vf  V_findAxes( extended Xmin, extended Xmax,
  56.                         extended Ymin, extended Ymax );
  57. void  __vf  V_drawAxes( extended Xmin, extended Xmax,
  58.                         extended Ymin, extended Ymax );
  59. void  __vf  V_continuePlot( void );
  60.  
  61. #ifdef __BORLANDC__
  62.     #pragma option -a-
  63. #else /* Visual C++ */
  64.     #pragma pack( push,1 )
  65. #endif /* avoid insertion of dummy bytes  */
  66. typedef struct {
  67.       int         left, top, right, bottom,
  68.                   outleft, outtop, outright, outbottom,
  69.                   nPixx, nPixy,
  70.                   xclipu, xclipl, yclipu, yclipl,
  71.                   cs, cl, cdot;
  72.       unsigned    linethickness, symlinethickness, DangerOver;
  73.       float       symbolsize, x_scale, y_scale;
  74.       extended    x_max, x_min, x_range, x_maxoverrange,
  75.                   y_max, y_min, y_range, y_maxoverrange;
  76.       } VCOORDSYSTEM;
  77. #ifdef __BORLANDC__
  78.        #pragma option -a.
  79. #else /* Visual C++ */
  80.        #pragma pack( pop )
  81. #endif    /* restore default data packing  */
  82.  
  83. void  __vf  V_setCoordSystem( VCOORDSYSTEM _VFAR *xcs );
  84. void  __vf  V_getCoordSystem( VCOORDSYSTEM _VFAR *xcs );
  85.  
  86. void  __vf  VF_xyAutoPlot(  fVector X, fVector Y, ui size,
  87.                             unsigned form, COLORREF color );
  88. void  __vf  VF_xy2AutoPlot( fVector X1, fVector Y1, ui size1,
  89.                             unsigned form1, COLORREF color1,
  90.                             fVector X2, fVector Y2, ui size2,
  91.                             unsigned form2, COLORREF color2 );
  92. void  __vf  VF_xyDataPlot(  fVector X, fVector Y, ui size,
  93.                             unsigned form, COLORREF color );
  94. void  __vf  VF_yAutoPlot(   fVector Y, ui size,
  95.                             unsigned form, COLORREF color );
  96. void  __vf  VF_y2AutoPlot(  fVector Y1, ui size1,
  97.                             unsigned form1, COLORREF color1,
  98.                             fVector Y2, ui size2,
  99.                             unsigned form2, COLORREF color2 );
  100. void  __vf  VF_yDataPlot(   fVector Y, ui size,
  101.                             unsigned form, COLORREF color );
  102. void  __vf  VCF_autoPlot(   cfVector X, ui size,
  103.                             unsigned form, COLORREF color );
  104. void  __vf  VCF_2AutoPlot(  cfVector X1, ui size1,
  105.                             unsigned form1, COLORREF color1,
  106.                             cfVector X2, ui size2,
  107.                             unsigned form2, COLORREF color2 );
  108. void  __vf  VCF_dataPlot(   cfVector X, ui size,
  109.                             unsigned form, COLORREF color );
  110.  
  111. void  __vf  VD_xyAutoPlot(  dVector X, dVector Y, ui size,
  112.                             unsigned form, COLORREF color );
  113. void  __vf  VD_xy2AutoPlot( dVector X1, dVector Y1, ui size1,
  114.                             unsigned form1, COLORREF color1,
  115.                             dVector X2, dVector Y2, ui size2,
  116.                             unsigned form2, COLORREF color2 );
  117. void  __vf  VD_xyDataPlot(  dVector X, dVector Y, ui size,
  118.                             unsigned form, COLORREF color );
  119. void  __vf  VD_yAutoPlot(   dVector Y, ui size,
  120.                             unsigned form, COLORREF color );
  121. void  __vf  VD_y2AutoPlot(  dVector Y1, ui size1,
  122.                             unsigned form1, COLORREF color1,
  123.                             dVector Y2, ui size2,
  124.                             unsigned form2, COLORREF color2 );
  125. void  __vf  VD_yDataPlot(   dVector Y, ui size,
  126.                             unsigned form, COLORREF color );
  127. void  __vf  VCD_autoPlot(   cdVector X, ui size,
  128.                             unsigned form, COLORREF color );
  129. void  __vf  VCD_2AutoPlot(  cdVector X1, ui size1,
  130.                             unsigned form1, COLORREF color1,
  131.                             cdVector X2, ui size2,
  132.                             unsigned form2, COLORREF color2 );
  133. void  __vf  VCD_dataPlot(   cdVector X, ui size,
  134.                             unsigned form, COLORREF color );
  135.  
  136. #ifdef __BORLANDC__   /* 80-bit IEEE numbers supported.
  137.                          The following lines apply
  138.                          only to Borland C++            */
  139. void  __vf  VE_xyAutoPlot(  eVector X, eVector Y, ui size,
  140.                             unsigned form, COLORREF color );
  141. void  __vf  VE_xy2AutoPlot( eVector X1, eVector Y1, ui size1,
  142.                             unsigned form1, COLORREF color1,
  143.                             eVector X2, eVector Y2, ui size2,
  144.                             unsigned form2, COLORREF color2 );
  145. void  __vf  VE_xyDataPlot(  eVector X, eVector Y, ui size,
  146.                             unsigned form, COLORREF color );
  147. void  __vf  VE_yAutoPlot(   eVector Y, ui size,
  148.                             unsigned form, COLORREF color );
  149. void  __vf  VE_y2AutoPlot(  eVector Y1, ui size1,
  150.                             unsigned form1, COLORREF color1,
  151.                             eVector Y2, ui size2,
  152.                             unsigned form2, COLORREF color2 );
  153. void  __vf  VE_yDataPlot(   eVector Y, ui size,
  154.                             unsigned form, COLORREF color );
  155. void  __vf  VCE_autoPlot(   ceVector X, ui size,
  156.                             unsigned form, COLORREF color );
  157. void  __vf  VCE_2AutoPlot(  ceVector X1, ui size1,
  158.                             unsigned form1, COLORREF color1,
  159.                             ceVector X2, ui size2,
  160.                             unsigned form2, COLORREF color2 );
  161. void  __vf  VCE_dataPlot(   ceVector X, ui size,
  162.                             unsigned form, COLORREF color );
  163.  
  164. #else   /* no 80-bit IEEE number support:
  165.      the following lines apply only to Visual C++ and Optima++ */
  166. #define VE_xyAutoPlot       VD_xyAutoPlot
  167. #define VE_xy2AutoPlot      VD_xy2AutoPlot
  168. #define VE_xyDataPlot       VD_xyDataPlot
  169. #define VE_yAutoPlot        VD_yAutoPlot
  170. #define VE_y2AutoPlot       VD_y2AutoPlot
  171. #define VE_yDataPlot        VD_yDataPlot
  172. #define VCE_autoPlot        VCD_autoPlot
  173. #define VCE_2AutoPlot       VCD_2AutoPlot
  174. #define VCE_dataPlot        VCD_dataPlot
  175.  
  176. #endif  /* 80-bit real support */
  177.  
  178. void  __vf  VBI_xyAutoPlot(  biVector X, biVector Y, ui bize,
  179.                              unsigned form, COLORREF color );
  180. void  __vf  VBI_xy2AutoPlot( biVector X1, biVector Y1, ui bize1,
  181.                              unsigned form1, COLORREF color1,
  182.                              biVector X2, biVector Y2, ui bize2,
  183.                              un